package com.itheima.homework;

import java.util.Scanner;

public class Dome5 {
    public static void main(String[] args) {
        System.out.println("请输入身份证号码:");
        Scanner sc = new Scanner(System.in);
        String ID = sc.nextLine();
        sf(ID);

    }

    public static void sf(String ID) {


        char[] chars = ID.toCharArray();
        if (chars.length == 18) {

            char f = ID.charAt(0);
            char e = ID.charAt(ID.length() - 1);


            if (f < 1 || f > 9) {
                System.out.println("输入有误");
            } else if ((e >= '0' && e <= '9') || e == 'X') {
                for (int i = 1; i < chars.length - 1; i++) {
                    if (chars[i] < '0' && chars[i] > '9') {
                        System.out.println("输入有误");
                        break;
                    }
                }
                System.out.println("输入正确");
            }


        } else {
            System.out.println("输出有误");
        }


    }

}